Skip to content

story: replace List search results without duplicating rows - #8

Closed
grishy wants to merge 1 commit into
sg-review-basefrom
sg-list-story-search
Closed

story: replace List search results without duplicating rows#8
grishy wants to merge 1 commit into
sg-review-basefrom
sg-list-story-search

Conversation

@grishy

@grishy grishy commented Sep 5, 2026

Copy link
Copy Markdown
Owner

List Story appends search matches to the previous results. Repeating a search or refreshing the data duplicates rows, and a query with no matches can leave old rows visible.

This clears each result group before rebuilding it from the source companies. The groups themselves stay in place so industry order and section indices do not change between queries. It also removes an extra empty group from initialization, which put companies and their industry headings at different indices.

Only the Story delegate and its regression test change. The List component and its public API are unchanged.

Screenshots

These show an unmatched query and the list after clearing it, not a before/after comparison. Company data is randomly generated on each launch.

No matches Query cleared
An unmatched query leaves no stale rows Clearing the query restores the company rows

How to Test

On macOS:

MTL_HUD_ENABLED=1 ./script/run-story-macos List

Use the company list's search field, not the sidebar search:

  1. Search for a company currently visible in the list. Only matching companies should remain.
  2. Enter no-company-matches-123. The list should be empty.
  3. Clear the query. The original companies should return under their industry headings.
  4. Repeat the first search and clear it again. Rows should not accumulate.

Correct filtering can expose the separate row-measurement bug fixed by #2975. If a filtered row overlaps its footer, that is not fixed here. The two patches should remain separate, with longbridge#2975 merged first.

The regression runs without opening a window:

cargo test -p gpui-component-story --lib searching_and_refreshing_replace_company_groups --locked

It failed before the fix and passes afterward. It checks case-insensitive matching, no matches, clearing the query, alignment between companies and industry groups, and rebuilding results without duplicates.

Automated checks
cargo test -p gpui-component-story --lib --locked
cargo clippy -p gpui-component-story --all-targets --locked -- -D warnings

All 14 Story library tests passed, along with strict Clippy, formatting, and the diff whitespace check. The agent also checked matching, empty, cleared, and repeated searches through the macOS accessibility tree.

Windows and Linux runtime were not tested.

Checklist

  • Read CONTRIBUTING.md and followed the guidelines.
  • Reviewed the final patch, including the AI-assisted changes.
  • Manually tested the related Story example on macOS.

AI assistance

I tested this fix in my application, then asked OpenAI's gpt-6-astra to extract it into a standalone PR. The agent prepared the patch, regression test, and description, and ran the automated checks. I reviewed the extracted patch, requested corrections, and manually tested it again on macOS.

Clear existing result groups before rebuilding them while keeping industry
indices stable. Initialize groups and industry labels in sync so headings
match their rows. Cover repeated, empty, cleared, and refreshed queries.
@grishy

grishy commented Sep 5, 2026

Copy link
Copy Markdown
Owner Author

Opened upstream as longbridge#2976 with the reviewed patch and description. Closing this review PR.

@grishy grishy closed this Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant